<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TaskFormHelper
 *
 * @author ww
 */
class TaskFormHelper {

    const STEP2_FORM_NAME = "step2_form";
    const STEP3_FORM_NAME = "step3_form";
    const STEP4_FORM_NAME = "step4_form";

    public static $form_name_by_step = array(self::STEP2_FORM_NAME=>2,self::STEP3_FORM_NAME=>3, self::STEP4_FORM_NAME=>4);
    
    public static $steps_links = array(array('name' => 'Шаг 1', 'link' => 'task/add/step1'), array('name' => 'Шаг 2', 'link' => 'task/add/step2'),
        array('name' => 'Шаг 3', 'link' => 'task/add/step3'), array('name' => 'Шаг 4', 'link' => 'task/add/step4'));
    
    public static $allowedtypes = array(
        "socialnetworks" => "Социальные сети",
        "reviews" => "Отзывы",
        "voting" => "Голосования",
        "twitter" => "Твиттер",
        "youtube" => "You Tube",
        "registrations" => "Регистрация",
        "clicks" => "Клики",
        "seo" => "SEO",
        "subscriber" => "Подписчики",
        "ppc" => "PPC",
        "surfing" => "Сёрфинг",
        "autosurfing" => "Автосёрфинг",
        "test" => "Тест",
        "letters" => "Чтение писем",
        "other" => "Другое"
    );

    
    public static function isAllowedStep($step, $type) {
        $registry = Registry::getInstance();
        $form_manager = $registry->form_manager;
        for ($i = 2; $i < array_search($step, self::$form_name_by_step); $i++) {
            if (!$form_manager->loadDataFromSession(self::$form_name_by_step[$i] . '_' . $type))
                return false;
        }
        return true;
    }

}

?>
